<?php
require_once ("../db/connectdatabase.php");

function insertLoanInVN($id, $bank, $mucdich, $namemucdich, $contry, $intro, $content, $introbasic) {
	$con = new ConnectDB();
	
	$tbl = "loaninvietnam";
	$fn = array('idlvn' => $id, 'bankid' => $bank, 'idpurpose' => $mucdich, 'namepurpose' => $namemucdich, 'address' => $contry, 'content' => $content, 'contentinfo' => $intro, 'contentinfobasic' => $introbasic, 'datecreate' => time());
	return $con -> insert($tbl, $fn);
}

function updateLoanInVN($id, $bank, $mucdich, $namemucdich, $country, $intro, $content, $introbasic) {
	$con = new ConnectDB();
	
	$tbl = "loaninvietnam";
	$fn = array('bankid' => $bank, 'idpurpose' => $mucdich, 'namepurpose' => $namemucdich, 'address' => $country, 'content' => $content, 'contentinfo' => $intro, 'contentinfobasic' => $introbasic, 'datecreate' => time());
	$condition = array('idlvn' => $id);
	return $con -> update($tbl, $fn, $condition);
}

function updateDisplayLoanInVN($id, $isuse) {
	$con = new ConnectDB();
	
	$tbl = "loaninvietnam";
	$fn = array('isuse' => $isuse);
	$condition = array('idlvn' => $id);
	return $con -> update($tbl, $fn, $condition);
}

function deleteLoanInVN($id) {
	$con = new ConnectDB();
	$tbl = "loaninvietnam";
	$condition = array('idlvn' => $id);
	return $con -> delete($tbl, $condition);
}

function getMucDich($id) {
	$con = new ConnectDB();
	
	$tbl = "purposeloan";
	$fn = array('idpurpose', 'namepurp');
	$condetion = array('idpurpose' => $id);
	return $con -> getvalue($tbl, $fn, $condetion);
}

function updateIntroLoan($id, $value) {
	$con = new ConnectDB();
	
	$tbl = "gioithieu";
	$fn = array('content' => $value);
	$condition = array('id' => $id);
	return $con -> update($tbl, $fn, $condition);
}
?>